/*
According to the main function and the output below, implement a class hierarchy with Fighter as the base class and Warrior is a derived class from Fighter.（Do not modify main() in any way.）
*/
#include <iostream>
using namespace std;

class Fighter{
private:
    string name;
public:
    Fighter(){};
    Fighter(string n){name = n;};
    void outTitle(){
        cout<<"We are fighters\n";
    }
    virtual void hello(){
        cout<<name<<" is a fighter.\n";
    }
    string getName(){return name;}
};

class Warrior: public Fighter{
private:
    string name1;
    string name2;
public:
    Warrior(string n1,Fighter* f){
        name1 = n1;
        name2 = f->getName();
    }
    void hello(){
        cout<<name1<<" is a stronger warrior than "<<name2<<".\n";
    }
};

int main()                                    
{  Fighter * objs[2];
   objs[0] = new Fighter("Harry");
   Warrior Stallone("Stallone", objs[0]);   
   objs[1] = &Stallone;
   cout << "== Test the class famliy ==" << endl;
   for(int i=0; i<2; i++) {
     objs[i] -> outTitle();
     cout << "----  " << i+1 << "  ----" << endl;
     objs[i] -> hello();
   }
   cout << "==This is the end." << endl;
   delete objs[0];
   return 0;
}